//
//  HACBasicComponents.m
//  Pods
//
//  Created by Hotacool on 2017/8/30.
//
//

#import "HACBasicComponents.h"

@implementation HACAxisComponents

- (instancetype)init {
    if (self = [super init]) {
        self.enable = YES;
        self.customAxisMin = NO;
        self.labelPosition = HACAxisLabelPositionInside;
        self.showGrid = YES;
//        self.textColor = [UIColor blackColor];
        self.spaceTop = 0;
        self.spaceBottom = 0;
        self.textFont = [UIFont systemFontOfSize:kAxisTextFontSize];
        self.extTextFont = [UIFont systemFontOfSize:kAxisTextFontSize];
    }
    return self;
}

@end

@implementation HACLineComponents
- (instancetype)init {
    self = [super init];
    if (self) {
        self.pointCount = 2;
        self.lineBolder = 1;
    }
    return self;
}

- (void)setLinePoints:(CGPoint *)linePoints {
    if (linePoints == NULL) {
        return;
    }
    if (_linePoints != NULL)
        free(_linePoints);
    
    size_t size = sizeof(CGPoint) * self.pointCount;
    _linePoints = malloc(size);
    memcpy(_linePoints, linePoints, size);
}

- (id)copyWithZone:(NSZone *)zone {
    HACLineComponents *comp = [[self class] allocWithZone:zone];
    comp.lineColor = self.lineColor;
    comp.isCurve = self.isCurve;
    comp.fillColor = self.fillColor;
    comp.isGradient = self.isGradient;
    comp.index = self.index;
    comp.lineBolder = self.lineBolder;
    comp.pointCount = self.pointCount;
    comp.pointArray = self.pointArray;
    comp.linePoints = self.linePoints;
    return comp;
}
@end

@implementation HACRectComponents

- (instancetype)init {
    self = [super init];
    if (self) {
        self.isSoildFill = YES;
    }
    return self;
}
@end

@implementation HACFocusComponents
- (instancetype)init {
    self = [super init];
    if (self) {
        self.lineBolder = 1;
        self.lineColor = RGB_HEX(kFocusLineColor);
        self.textColor = RGB_HEX(kMainTextColor);
        self.textFont = [UIFont systemFontOfSize:13];
        
        self.borderWidth = 0.6;
        self.bgColor = [UIColor colorWithWhite:0.9 alpha:0.5];
//        self.borderColor = [UIColor brownColor];
    }
    return self;
}

@end
